package com.cskaoyan._12loop;

/**
 * @description:
 * @author: 景天
 * @date: 2023/1/29 17:28
 **/
/*
用for循环求出1-100之间偶数和
 */
public class Demo2 {
    public static void main(String[] args) {
        int sum = 0;
        // 快捷键 fori

        for (int i = 1; i < 101; i++) {
            if (i % 2 == 0) {
                sum += i;
            }
        }
        // 输出
        System.out.println("sum = " + sum);
    }
}
